target, nums = 7, [2,3,1,2,4,3]

result, i, sums = len(nums), 0, 0
for j in nums:
    sums += nums[j]
    print('j===', j, nums.index(j))
    while sums >= target:
        subL = j - i + 1
        if subL < result:
            result = subL
        sums -= nums[i]
        i += 1
if result == len(nums):
    result = 0
print(result)